import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 库存台账备份信息 */
export interface StoreInitBackup {
          id: number; // id
          customerAccount?: string; // 客户账号
          customerName: string; // 客户
          storeLocation: string; // 仓库地点
          storeName: string; // 仓库名称
          drawingNumber: string; // 图号
          productName: string; // 品名
          initAmount?: number; // 期初数量
          currentAmount?: number; // 当前库存
          backupDate?: string | Dayjs; // 备份日期
  }

// 库存台账备份 API
export const StoreInitBackupApi = {
  // 查询库存台账备份分页
  getStoreInitBackupPage: async (params: any) => {
    return await request.get({ url: `/business/store-init-backup/page`, params })
  },

  // 查询库存台账备份详情
  getStoreInitBackup: async (id: number) => {
    return await request.get({ url: `/business/store-init-backup/get?id=` + id })
  },

  // 新增库存台账备份
  createStoreInitBackup: async (data: StoreInitBackup) => {
    return await request.post({ url: `/business/store-init-backup/create`, data })
  },

  // 修改库存台账备份
  updateStoreInitBackup: async (data: StoreInitBackup) => {
    return await request.put({ url: `/business/store-init-backup/update`, data })
  },

  // 删除库存台账备份
  deleteStoreInitBackup: async (id: number) => {
    return await request.delete({ url: `/business/store-init-backup/delete?id=` + id })
  },

  /** 批量删除库存台账备份 */
  deleteStoreInitBackupList: async (ids: number[]) => {
    return await request.delete({ url: `/business/store-init-backup/delete-list?ids=${ids.join(',')}` })
  },

  // 导出库存台账备份 Excel
  exportStoreInitBackup: async (params) => {
    return await request.download({ url: `/business/store-init-backup/export-excel`, params })
  }
}